// ignore_for_file: overridden_fields

import 'package:flutter/material.dart';
import 'app_color.dart';

/// 字体样式库
class AppTextTheme extends TextTheme {
  @override
  final TextStyle? displayLarge;
  @override
  final TextStyle? displayMedium;
  @override
  final TextStyle? displaySmall;
  @override
  final TextStyle? headlineLarge;
  @override
  final TextStyle? headlineMedium;
  @override
  final TextStyle? headlineSmall;
  @override
  final TextStyle? titleLarge;
  @override
  final TextStyle? titleMedium;
  @override
  final TextStyle? titleSmall;
  @override
  final TextStyle? bodyLarge;
  @override
  final TextStyle? bodyMedium;
  @override
  final TextStyle? bodySmall;
  @override
  final TextStyle? labelLarge;
  @override
  final TextStyle? labelMedium;
  @override
  final TextStyle? labelSmall;

  static AppTextTheme? _current;

  static get current => _current;

  const AppTextTheme(
      {this.displayLarge,
      this.displayMedium,
      this.displaySmall,
      this.headlineLarge,
      this.headlineMedium,
      this.headlineSmall,
      this.titleLarge,
      this.titleMedium,
      this.titleSmall,
      this.bodyLarge,
      this.bodyMedium,
      this.bodySmall,
      this.labelLarge,
      this.labelMedium,
      this.labelSmall})
      : super(
          displayLarge: displayLarge,
          displayMedium: displayMedium,
          displaySmall: displaySmall,
          headlineLarge: headlineLarge,
          headlineMedium: headlineMedium,
          headlineSmall: headlineSmall,
          titleLarge: titleLarge,
          titleMedium: titleMedium,
          titleSmall: titleSmall,
          bodyLarge: bodyLarge,
          bodyMedium: bodyMedium,
          bodySmall: bodySmall,
          labelLarge: labelLarge,
          labelMedium: labelMedium,
          labelSmall: labelSmall,
        );

  static AppTextTheme load({double baseTextSize = 10.0}) {
    if (_current != null) {
      return _current!;
    }
    _current = AppTextTheme(
        displayLarge: TextStyle(
            fontSize: baseTextSize + 14.0, fontWeight: FontWeight.w500, color: AppColor.primaryText, decoration: TextDecoration.none),
        displayMedium: TextStyle(
            fontSize: baseTextSize + 12.0, fontWeight: FontWeight.w500, color: AppColor.primaryText, decoration: TextDecoration.none),
        displaySmall: TextStyle(
            fontSize: baseTextSize + 12.0, fontWeight: FontWeight.normal, color: AppColor.primaryText, decoration: TextDecoration.none),
        headlineLarge: TextStyle(
            fontSize: baseTextSize + 10.0, fontWeight: FontWeight.w500, color: AppColor.primaryText, decoration: TextDecoration.none),
        headlineMedium: TextStyle(
            fontSize: baseTextSize + 10.0, fontWeight: FontWeight.normal, color: AppColor.primaryText, decoration: TextDecoration.none),
        headlineSmall: TextStyle(
            fontSize: baseTextSize + 8.0, fontWeight: FontWeight.w500, color: AppColor.primaryText, decoration: TextDecoration.none),
        titleLarge: TextStyle(
            fontSize: baseTextSize + 6.0, fontWeight: FontWeight.w500, color: AppColor.primaryText, decoration: TextDecoration.none),
        titleMedium: TextStyle(
            fontSize: baseTextSize + 6.0, fontWeight: FontWeight.normal, color: AppColor.primaryText, decoration: TextDecoration.none),
        titleSmall: TextStyle(
            fontSize: baseTextSize + 4.0, fontWeight: FontWeight.w500, color: AppColor.primaryText, decoration: TextDecoration.none),
        bodyLarge: TextStyle(
            fontSize: baseTextSize + 4.0, fontWeight: FontWeight.normal, color: AppColor.primaryText, decoration: TextDecoration.none),
        bodyMedium: TextStyle(
            fontSize: baseTextSize + 2.0, fontWeight: FontWeight.w500, color: AppColor.primaryText, decoration: TextDecoration.none),
        bodySmall: TextStyle(
            fontSize: baseTextSize + 2.0, fontWeight: FontWeight.normal, color: AppColor.primaryText, decoration: TextDecoration.none),
        labelLarge:
            TextStyle(fontSize: baseTextSize + 1.0, fontWeight: FontWeight.w500, color: AppColor.primaryText, decoration: TextDecoration.none),
        labelMedium:
            TextStyle(fontSize: baseTextSize, fontWeight: FontWeight.w500, color: AppColor.primaryText, decoration: TextDecoration.none),
        labelSmall:
            TextStyle(fontSize: baseTextSize, fontWeight: FontWeight.normal, color: AppColor.primaryText, decoration: TextDecoration.none));
    return _current!;
  }
}
